---
layout: m1x_soap
title: Media Update
---

<h2><a name="catalog_product_attribute_media.update-Module%3AMageCatalog"></a>Module: Mage_Catalog</h2>


<h4><a name="catalog_product_attribute_media.update-Resource%3Acatalogproductattributemedia"></a>Resource:catalog_product_attribute_media</h4>

<p><b>Aliases:</b></p>
<ul>
	<li>product_attribute_media</li>
	<li>product_media</li>
</ul>


<h4><a name="catalog_product_attribute_media.update-Method%3A"></a>Method:</h4>

<ul>
	<li>catalog_product_attribute_media.update (SOAP V1)</li>
	<li>catalogProductAttributeMediaUpdate (SOAP V2)</li>
</ul>


<p>Allows you to update the product image.</p>

<p><b>Aliases:</b></p>
<ul>
	<li>product_attribute_media.update</li>
	<li>product_media.update</li>
</ul>


<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> product\productId <br class="atl-forced-newline" /> </td>
<td> Product ID or code </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> file <br class="atl-forced-newline" /> </td>
<td> Image file name (e.g., /i/m/image.jpeg) </td>
</tr>
<tr>
<td> array </td>
<td> data <br class="atl-forced-newline" /> </td>
<td> Array of catalogProductAttributeMediaCreateEntity </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> storeView <br class="atl-forced-newline" /> </td>
<td> Store view ID or code </td>
</tr>
<tr>
<td> string </td>
<td> identifierType </td>
<td> Defines whether the product ID or SKU is passed in the 'product' parameter </td>
</tr>
</tbody></table>


<p><b>Notes</b>: You should specify only those parameters which you want to be updated. Parameters that were not specified in the request, will preserve the previous values.</p>

<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> boolean </td>
<td> result </td>
<td> Result of product image updating </td>
</tr>
</tbody></table>


<p>The <b>catalogProductAttributeMediaCreateEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description <br class="atl-forced-newline" /> </th>
</tr>
<tr>
<td> array </td>
<td> file <br class="atl-forced-newline" /> </td>
<td> Array of catalogProductImageFileEntity <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td> string </td>
<td> label <br class="atl-forced-newline" /> </td>
<td> Product image label </td>
</tr>
<tr>
<td> string </td>
<td> position <br class="atl-forced-newline" /> </td>
<td> Product image position </td>
</tr>
<tr>
<td> ArrayOfString </td>
<td> types <br class="atl-forced-newline" /> </td>
<td> Array of types </td>
</tr>
<tr>
<td> string </td>
<td> exclude <br class="atl-forced-newline" /> </td>
<td> Defines whether the image will associate only to one of three image types </td>
</tr>
<tr>
<td> string </td>
<td> remove <br class="atl-forced-newline" /> </td>
<td> Image remove flag </td>
</tr>
</tbody></table>


<p>The <b>catalogProductImageFileEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> content </td>
<td> Product image content (base_64 encoded) </td>
</tr>
<tr>
<td> string </td>
<td> mime </td>
<td> Image mime type (e.g., image/jpeg) </td>
</tr>
<tr>
<td> string </td>
<td> name </td>
<td> Image name </td>
</tr>
</tbody></table>


<h4><a name="catalog_product_attribute_media.update-Examples"></a>Examples</h4>

<h5><a name="catalog_product_attribute_media.update-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$productId = 1;
$file = '/i/m/image.jpg';

$newFile = array(
	'content' =&gt; '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
	'mime' =&gt; 'image/jpeg'
);

$result = $client-&gt;call(
	$session,
	'catalog_product_attribute_media.update',
	array(
		$productId,
		$file,
		array('file' =&gt; $newFile, 'label' =&gt; 'New label', 'position' =&gt; '50', 'types' =&gt; array('image'), 'exclude' =&gt; 1)
	)
);</pre>
		</div>
</div></div>

<h5><a name="catalog_product_attribute_media.update-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$productId = 1;
$file = '/i/m/image.jpg';

$newFile = array(
'content' =&gt; '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
'mime' =&gt; 'image/jpeg'
);

$result = $client-&gt;catalogProductAttributeMediaUpdate(
$session,
$productId,
$file,
array('file' =&gt; $newFile, 'label' =&gt; 'New label', 'position' =&gt; '50', 'types' =&gt; array('image'), 'exclude' =&gt; 1)
);</pre>
		</div>
</div></div>


<h5><a name="catalog_product_attribute_media.update-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey'));

$result = $proxy-&gt;catalogProductAttributeMediaUpdate((object)array('sessionId' =&gt; $sessionId-&gt;result, 'productId' =&gt; '1', 'file' =&gt; '/t/u/tulips.jpg', 'data' =&gt; ((object)array(
'label' =&gt; 'tulips',
'position' =&gt; '1',
'remove' =&gt; '0',
'types' =&gt; array('small_image')
))));

var_dump($result-&gt;result);</pre>
		</div>
</div></div>


